{#include main fluid=true}
  {#style}
   .annotation {
     color: gray;
     font-style: italic;
   }
   span.larger-badge {
     font-size: 0.9em;
   }
   span.app-class {
     cursor:pointer;
     color:blue;
     text-decoration:underline;
   }
  {/style}

  {#script}
    $(document).ready(function(){
      if (!ideKnown()) {
        return;
      }
      $(".class-candidate").each(function() {
        var className = $(this).text();
        if (appClassLocation(className)) {
          $(this).addClass("app-class");
        }
      });

      $(".app-class").on("click", function() {
        openInIDE($(this).text());
      });
    });
  {/script}

  {#title}Guarded Methods{/title}

  {#body}
  <table class="table table-striped">
    <thead class="thead-dark">
      <tr>
        <th scope="col">#</th>
        <th scope="col">Bean Class</th>
        <th scope="col">Method</th>
        <th scope="col">Fault Tolerance Strategies</th>
      </tr>
    </thead>
    <tbody>
      {#for ftOperation in info:ftOperations}
      <tr>
        <td>{ftOperation_count}</td>
        <td>
          <span class="class-candidate" title="{ftOperation.beanClass.name}">{#if ftOperation.beanClass.name.length > 70}{ftOperation.beanClass.name.substring(0,70)}...{#else}{ftOperation.beanClass.name}{/if}</span>
        </td>
        <td>
          <code><span title="{ftOperation.methodDescriptor.declaringClass.name}#{ftOperation.methodDescriptor.name}()">{ftOperation.methodDescriptor.name}()</span></code>
        </td>
        <td>
          <ul>
            {#if ftOperation.applyFaultTolerance}
            <li>
              @ApplyFaultTolerance<span class="annotation">("{ftOperation.applyFaultTolerance.value}")</span>
            </li>
            {/if}

            {#if ftOperation.asynchronous}
            <li>@Asynchronous</li>
            {/if}

            {#if ftOperation.blocking}
            <li>@Blocking</li>
            {/if}

            {#if ftOperation.nonBlocking}
            <li>@NonBlocking</li>
            {/if}

            {#if ftOperation.bulkhead}
            <li>@Bulkhead<span class="annotation">(value = {ftOperation.bulkhead.value},
                waitingTaskQueue = {ftOperation.bulkhead.waitingTaskQueue})</span></li>
            {/if}

            {#if ftOperation.circuitBreaker}
            <li>
              @CircuitBreaker<span class="annotation">(delay = {ftOperation.circuitBreaker.delay} {ftOperation.circuitBreaker.delayUnit.name},
                requestVolumeThreshold = {ftOperation.circuitBreaker.requestVolumeThreshold},
                failureRatio = {ftOperation.circuitBreaker.failureRatio},
                successThreshold = {ftOperation.circuitBreaker.successThreshold},
                failOn = [{#each ftOperation.circuitBreaker.failOn}{it.name}{#if it_hasNext}, {/if}{/each}],
                skipOn = [{#each ftOperation.circuitBreaker.skipOn}{it.name}{#if it_hasNext}, {/if}{/each}])</span>
              {#if ftOperation.circuitBreakerName}
              <ul>
                <li>@CircuitBreakerName<span class="annotation">("{ftOperation.circuitBreakerName.value}")</span></li>
              </ul>
              {/if}
            </li>
            {/if}

            {#if ftOperation.fallback}
            <li>
              @Fallback<span class="annotation">(value = {ftOperation.fallback.value.name},
                fallbackMethod = "{ftOperation.fallback.fallbackMethod}",
                applyOn = [{#each ftOperation.fallback.applyOn}{it.name}{#if it_hasNext}, {/if}{/each}],
                skipOn = [{#each ftOperation.fallback.skipOn}{it.name}{#if it_hasNext}, {/if}{/each}])</span>
            </li>
            {/if}

            {#if ftOperation.rateLimit}
            <li>
              @RateLimit<span class="annotation">(value = {ftOperation.rateLimit.value},
                window = {ftOperation.rateLimit.window} {ftOperation.rateLimit.windowUnit.name},
                minSpacing = {ftOperation.rateLimit.minSpacing} {ftOperation.rateLimit.minSpacingUnit.name},
                type = {ftOperation.rateLimit.type.name})</span>
            </li>
            {/if}

            {#if ftOperation.retry}
            <li>
              @Retry<span class="annotation">(maxRetries = {ftOperation.retry.maxRetries},
                delay = {ftOperation.retry.delay} {ftOperation.retry.delayUnit.name},
                maxDuration = {ftOperation.retry.maxDuration} {ftOperation.retry.durationUnit.name},
                jitter = {ftOperation.retry.jitter} {ftOperation.retry.jitterDelayUnit.name},
                retryOn = [{#each ftOperation.retry.retryOn}{it.name}{#if it_hasNext}, {/if}{/each}],
                abortOn = [{#each ftOperation.retry.abortOn}{it.name}{#if it_hasNext}, {/if}{/each}])</span>
              {#if ftOperation.exponentialBackoff || ftOperation.fibonacciBackoff || ftOperation.customBackoff}
              <ul>
                {#if ftOperation.exponentialBackoff}
                <li>@ExponentialBackoff<span class="annotation">(factor = {ftOperation.exponentialBackoff.factor},
                    maxDelay = {ftOperation.exponentialBackoff.maxDelay} {ftOperation.exponentialBackoff.maxDelayUnit.name})</span></li>
                {/if}
                {#if ftOperation.fibonacciBackoff}
                <li>@FibonacciBackoff<span class="annotation">(maxDelay = {ftOperation.fibonacciBackoff.maxDelay} {ftOperation.fibonacciBackoff.maxDelayUnit.name})</span></li>
                {/if}
                {#if ftOperation.customBackoff}
                <li>@CustomBackoff<span class="annotation">({ftOperation.customBackoff.value.name})</span></li>
                {/if}
              </ul>
              {/if}
            </li>
            {/if}

            {#if ftOperation.timeout}
            <li>
              @Timeout<span class="annotation">({ftOperation.timeout.value} {ftOperation.timeout.unit.name})</span>
            </li>
            {/if}
          </ul>
        </td>
      </tr>
      {/for}
    </tbody>
  </table>
  {/body}
{/include}
